﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	
	
<title>添加</title>
<style type="text/css">
#authDiv {
	
}

#authDiv ul {
	margin: 0px;
	padding: 0px;
	list-style-type: none;
	vertical-align: middle;
}

#authDiv li {
	float: left;
	display: block;
	width: 100px;
	height: 20px;
	line-height: 20px;
	font-size: 14px;
	font-weight: bold;
	color: #666666;
	text-decoration: none;
	text-align: left;
	background: #ffffff;
}
</style>

<script type="text/javascript">
var url = "auth/all";
 $.get(url,function(data,status){
	 var auths=data.data;
	    var ul=document.createElement("ul");
	    for(var i=0;i<auths.length;i++){
	        var auth=auths[i];

	        // 加入复选框
	        var checkBox=document.createElement("input");
	        checkBox.setAttribute("type","checkbox");
	        checkBox.setAttribute("id","authIds");
	        checkBox.setAttribute("value",auth.authId);
	        checkBox.setAttribute("name", "authIds");

	        var li=document.createElement("li");
	        li.appendChild(checkBox);        
	        li.appendChild(document.createTextNode(auth.authName));

	        ul.appendChild(li);        
	    }
	    document.getElementById("authDiv").appendChild(ul);
 });
</script>
<div class="panel admin-panel">
	<div class="panel-head" id="add">
		<strong><span class="icon-pencil-square-o"></span>添加管理员</strong>
	</div>
	<div class="body-content">
		<form method="post" class="form-x" action="admin/insert">
			<div class="form-group">
				<div class="label">
					<label>管理员账号: </label>
				</div>
				<div class="field">
					<input type="text" onchange="admin.exists(this);" class="input w50" name="account"
						data-validate="required:请输入管理员账号" value="admin" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>管理员密码: </label>
				</div>
				<div class="field">
					<input type="password" class="input w50" name="password"
						data-validate="required:请输入管理员密码" value="admin" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>管理员邮箱: </label>
				</div>
				<div class="field">
					<input type="text" class="input w50" name="email"
						data-validate="required:请输入管理员密码" value="admin@163.com" />
					<div class="tips"></div>
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label>管理员头像：</label>
				</div>
				<div class="field">
					<div id="preview_div">
						<img id="preview_img" src="images/y.jpg">
					</div>
					<a href="javascript:;" class="file">选择图片 <input
						class="serverImg" type="text" id="headImg" name="head" /> 
						<input type="file" id="img" name="img" onchange="previewImage(this,'headImg');">
					</a>
					<div class="tipss">尺寸: 200*200 大小:0-50KB</div>
				</div>
			</div>

			<div class="form-group">
				<div class="label">
					<label>管理员权限：</label>
				</div>
				<div class="field">
					<div id="authDiv"></div>
					<div class="tips"></div>
				</div>
			</div>
			<div class="clear"></div>

			<div class="form-group">
				<div class="label">
					<label></label>
				</div>
				<div class="field">
					<button class="button bg-main icon-check-square-o" type="submit">
						提交</button>
				</div>
			</div>
		</form>
	</div>
</div>